package com.xdm.ui.adapter.android;

import xwt.ImplementationWrapper;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;

import com.xdm.XManager;
import com.xdm.ui.XmItemPanelView;
import com.xdm.ui.XmOnItemClickListener;

/**
 * XMOnItemClickListener adapter for Android 
 * 
 * @author Alexander Lapygin
 */
public class AndroidOnItemClickListener extends ImplementationWrapper implements XmOnItemClickListener {
	private XManager xManager;
	public AndroidOnItemClickListener(final XManager xManager) {
		this.xManager = xManager;
		this.setImplementation(new OnItemClickListener() {
			public void onItemClick(AdapterView parent, View v, int position, long id) {
				XmItemPanelView itemPanelView = xManager.getItemPanelView(parent.getId() + "");
				AndroidOnItemClickListener.this.onItemClick(itemPanelView, position);
		 	}
		});
	}

	public void onItemClick(XmItemPanelView parentView, int position) {
		xManager.onItemClick(parentView, position);
	}
}
